import interceptor from './interceptor';

// 查询未审核数据
const AUDIT_LIST_URL = '/webapi/2.0/feature/changes';
// 审核更新数据
const AUDIT_UPDATE_DATA_URL = '/webapi/2.0/feature/audit';
const AUDIT_INSERT_DATA_URL = '/webapi/authority/updateFeature';
// 删除图层
const DELETE_LAYER_URL = '/webapi/authority/deleteLayer';
// 导出
const EXPORT_LAYER_URL = '/webapi/2.0/export/excel';
// 导入
const IMPORT_LAYER_URL = '/webapi/authority/uploadshpfile';

const MODIFY_LAYER_URL = 'webapi/authority/modifyLayerTree';

// 文件查看
const PREVIEW_IMAGE_URL = '/webapi/2.0/image/view';

// wms服务详情查询
const WMS_FEATURE_DETAIL_URL = '/webapi/2.0/feature/wms';

export default {
    // 获取审核数据列表
    getAuditList(params) {
        const promise = interceptor.get(AUDIT_LIST_URL, {
            params,
        });
        return promise;
    },
    auditUpdateData(data) {
        const promise = interceptor.post(AUDIT_UPDATE_DATA_URL, data);
        return promise;
    },
    auditInsertData(data) {
        const promise = interceptor.post(AUDIT_INSERT_DATA_URL, data);
        return promise;
    },
    // 删除图层
    deleteLayer(params) {
        const promise = interceptor.delete(DELETE_LAYER_URL, { params });
        return promise;
    },
    modifyLayer(data) {
        const promise = interceptor.post(MODIFY_LAYER_URL, data);
        return promise;
    },
    exportLayer(params) {
        const promise = interceptor.get(EXPORT_LAYER_URL, {
            params,
        });
        return promise;
    },

    importFile(data) {
        const promise = interceptor.post(IMPORT_LAYER_URL, data);
        return promise;
    },

    getImageUrl(params) {
        const promise = interceptor.get(PREVIEW_IMAGE_URL, {
            params,
        });
        return promise;
    },

    // 查询wms服务图层要素详情
    getWmsFeatureInfo(params) {
        const promise = interceptor.get(WMS_FEATURE_DETAIL_URL, {
            params,
        });
        return promise;
    }
};
